package com.miniapp.web.controller.miniapp.api;

import com.alibaba.fastjson.JSONObject;
import com.miniapp.basics.entity.R;
import com.miniapp.common.core.domain.model.miniapp.WxLoginBody;
import com.miniapp.common.exception.MiniAppException;
import com.miniapp.framework.web.service.MiniAppLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/miniapp")
public class WxLoginController
{

    @Autowired
    private MiniAppLoginService miniAppLoginService;

    @PostMapping("/wxMiniLogin")
    public R wxMiniLogin(@RequestBody WxLoginBody wxLoginBody) throws MiniAppException
    {
        JSONObject data = miniAppLoginService.wxMiniLogin(wxLoginBody);
        return R.success(data);
    }

}
